<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<script type="text/javascript" src="${ctx}/includes/officecontrol/OfficeContorlFunctions.js" charset="utf-8"></script>
	<script type="text/javascript">
		function saveWjnr(){
			saveFileToUrl();
		}
	</script>
</head>
<body onload='intializePage("${ctx}/filedownload.do?fileAsName=${attachid}")'>
	<s:form action="attach/updateDoc.do" method="post">
	<s:hidden name="attachid"/>
	<input type="hidden" id="fileName" name="fileName" value="${name}"/>
	<div id="officecontrol">
    	
    	<script type="text/javascript" src="${ctx}/includes/officecontrol/ntkoofficecontrol.js" charset="utf-8"></script>
    	<%-- 
    	<object id="TANGER_OCX" classid="clsid:C9BC4DFF-4248-4a3c-8A49-63A7D317F404"    
			codebase="/shfw/includes/officecontrol/OfficeControl.cab#version=5,0,1,8" width="100%" height="100%">   
			<param name="IsUseUTF8URL" value="-1">   
			<param name="IsUseUTF8Data" value="-1">   
			<param name="BorderStyle" value="1">   
			<param name="BorderColor" value="14402205">   
			<param name="TitlebarColor" value="15658734">   
			<param name="TitlebarTextColor" value="0">   
			<param name="MenubarColor" value="14402205">   
			<param name="MenuButtonColor" VALUE="16180947">   
			<param name="MenuBarStyle" value="3">   
			<param name="MenuButtonStyle" value="7">   
			<param name="WebUserName" value="NTKO">   
			<param name="Caption" value="在线文档控件(双击全屏显示)">   
			<param name="ProductCaption" value="株洲南车时代电气股份有限公司"> 
			<param name="ProductKey" value="76D714B107F2FE517A9B3370AE6CF0A80509E2DD">
			<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN>   
		</object>
		--%>
    	<div id=statusBar style="height:20px;width:100%;background-color:#c0c0c0;font-size:12px;"></div>
			<script language="JScript" for=TANGER_OCX event="OnDocumentClosed()">
				setFileOpenedOrClosed(false);
			</script>
			<script language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj)">
				OFFICE_CONTROL_OBJ.Menubar = false;
				//OFFICE_CONTROL_OBJ.activeDocument.saved=true;//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
				//OFFICE_CONTROL_OBJ.SetReadOnly(true);
				//OFFICE_CONTROL_OBJ.FullScreenMode= true
				//获取文档控件中打开的文档的文档类型
				switch(OFFICE_CONTROL_OBJ.doctype)
				{
					case 1:
						fileType = "Word.Document";
						fileTypeSimple = "wrod";
						break;
					case 2:
						fileType = "Excel.Sheet";
						fileTypeSimple="excel";
						break;
					case 3:
						fileType = "PowerPoint.Show";
						fileTypeSimple = "ppt";
						break;
					case 4:
						fileType = "Visio.Drawing";
						break;
					case 5:
						fileType = "MSProject.Project";
						break;
					case 6:
						fileType = "WPS Doc";
						fileTypeSimple="wps";
						break;
					case 7:
						fileType = "Kingsoft Sheet";
						fileTypeSimple="et";
						break;
					default :
						fileType = "unkownfiletype";
						fileTypeSimple="unkownfiletype";
				}
				setFileOpenedOrClosed(true);
			</script>
			<script language="JScript" for=TANGER_OCX event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj)">
				alert("BeforeOriginalMenuCommand事件被触发");
			</script>
			<script language="JScript" for=TANGER_OCX event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj)">
				if (TANGER_OCX_str == 3) 
				{
					//alert("不能保存！");
					CancelLastCommand = true;
					saveFileToUrl();
				}
			</script>
    	</div>
    </div>
    </s:form>
</body>
</html>
